<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!-- 下面一句代码是导包 -->
<%@ page import="java.util.*,org.lanqiao.tjut.bean.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<%
		//构造froeach标签需要解析的数据
		//将数据缓存在session对象中
		// 数据结构是 list + entity 表示查询结果的二维表结构
		List listu = new ArrayList();
		beanStudent stu1 = new beanStudent();
		stu1.setStuid(1001);
		stu1.setStuName("小明");
		stu1.setStusex("男");
		stu1.setStuage(20);
		listu.add(stu1);

		beanStudent stu2 = new beanStudent();
		stu2.setStuid(1002);
		stu2.setStuName("小王");
		stu2.setStusex("男");
		stu2.setStuage(21);
		listu.add(stu2);

		beanStudent stu3 = new beanStudent();
		stu3.setStuid(1003);
		stu3.setStuName("小李");
		stu3.setStusex("女");
		stu3.setStuage(22);
		listu.add(stu3);

		beanStudent stu4 = new beanStudent();
		stu4.setStuid(1004);
		stu4.setStuName("小强");
		stu4.setStusex("男");
		stu4.setStuage(25);
		listu.add(stu4);

		//设置数据验证map集合的遍历，并在web输出

		List lstmaps = new ArrayList();

		Map map1 = new LinkedHashMap();
		map1.put("name", "小明");
		map1.put("age", "20");
		map1.put("性别", "男");
		lstmaps.add(map1);

		Map map2 = new LinkedHashMap();
		map2.put("name", "小强");
		map2.put("age", "21");
		map2.put("性别", "女");
		lstmaps.add(map2);

		session.setAttribute("lstmaps", lstmaps);

		//将数据放入sessio缓存中
		//session.setAttribute("listu", listu);
		//session.removeAttribute("listu");
		request.setAttribute("listu", listu);
	%>

	<!--  下面是jsp(bootstrap效果)页面效果 -->
	<!--用的jsp的include指令获取inc.jsp。里边是bootstrap的框架 -->
	<%@include file="inc.jsp"%>

	<div align="center">
		<div style="width: 700px; height: 500px;">
			<h4>班级信息</h4>
			<table class="table table-bordered table-hover"
				style="text-align: center;">
				<tbody>
					<tr class="success">
						<td>编号</td>
						<td>学号</td>
						<td>姓名</td>
						<td>性别</td>
						<td>年龄</td>
					</tr>
					<!-- forEach标签 ,以及EL表达式-->
					<c:forEach items="${requestScope.listu}" var="eachStu"
						varStatus="statu">
						<tr>
							<td>${statu.index+1}</td>
							<td>${eachStu.stuid}</td>
							<td>${eachStu.stuName}</td>
							<td>${eachStu.stusex}</td>
							<td>${eachStu.stuage}</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		</div>
	</div>
	<br> 遍历list-map集合:
	<br>
	<!-- 遍历map集合 因为是list集合嵌套map集合 所以应该两次foreach循环，第一次遍历list集合，第二次遍历map集合，取出键值对 -->
	<c:forEach items="${sessionScope.lstmaps}" var="val" varStatus="st">
		<c:out value="${st.count}"></c:out>
		&nbsp;
		<br>
		<!-- 遍历map集合 -->
		<c:forEach items="${val}" var="each" varStatus="st2">
		&nbsp;&nbsp;
			<c:out value="${st2.count}"></c:out>
			<c:out value="${each.key}"></c:out>
			<c:out value="${each.value}"></c:out>
			<br>
		</c:forEach>
	</c:forEach>

</body>

</html>